var app = getApp();
Page({
    data:{
        page : {
            isend : false,
            doing : false,
            doo : 'fenxiao',
            pdata : {
                op : 'checkbill',
                page : 1,
                type : 0,
                mtype : '',
                time : '',
            },
            waitf : 0,
            nodataf : 0,
        },
        tab : {
            color : '#fb2d37',
            list: [{
            id: '0',
                title: '收入',
            },{
            id: '1',
                title: '支出',
            }],
            selectedId: '0',
            scroll: false
        },
        datalist : [],
		siteroot : app.siteInfo.siteroot.replace('app/index.php', ''),uniacid: app.siteInfo.uniacid,
    },
    onLoad:function(options){
        var self = this;

        var zfid = options.zfid ? options.zfid : '';
        self.setData({
            'page.pdata.zfid' : zfid,
            'page.pdata.mtype' : options.mtype ? options.mtype : '',
            'page.pdata.time' : options.time ? options.time : '',
        });

        app.com.auth(function(user){
            app.com.getPage(self,self.data.page,20,function(res){
                var data = res.data.data;
                self.setData({
                   datalist : data.list,
                   Pagetheme : res.data.data.params.style,
                   sharedata : res.data.data.sharedata,
                },function(){
                    self.setData({
                        inited : true,
                    });
                });

            },false,function(res){
                app.com.alert(res.data.message);
            });
        });
       
    },
    tapClick(e){
        var self = this;
        var index = e.detail.index;
        
        if( self.data.ising ||  index == self.data.page.pdata.type ) return false;
        self.data.ising = true;

        self.setData({
            'page.pdata.type' : index,
            'page.pdata.page' : 1,
            'page.isend' : false,
            'page.waitf' : 0,
            'page.nodataf' : 0
        });

        app.com.getPage(self,self.data.page,20,function(res){
            self.setData({
                datalist : res.data.data.list,
            });
            wx.pageScrollTo({
                scrollTop: 0
            });
        });

        self.data.ising = false;
    },
    onReachBottom : function(){
        var self = this;
        app.com.getPage(self,self.data.page,20,function(res){
            self.setData({
                datalist : self.data.datalist.concat(res.data.data.list)
            });
        });
    },
    location : function( e ){
        app.com.location( e );
    },
    otherapp : function( e ){
        app.com.otherapp( e );
    },
    navigateto : function( e ){
        app.com.navigateto( e );
    },
    redirectto : function( e ){
        app.com.redirectto( e );
    },    
    callphone : function(e){
        app.com.callphone( e );
    },
    toweburl : function(e){
        app.com.toweburl( e );
    },
    showimages : function( e ){
        app.com.showimages( e );
    }
    

})